<!DOCTYPE html>
<html class="x-admin-sm">

{include file="common/static" /}
{include file="common/resources" /}
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">房间号：{$list.room_num}</a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <tbody>
                        <tr>
                            <td>
                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label">
                                        <span class="x-red">用户姓名</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="guest_name" required="" lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                        <input type="text" value="{$room_id}" id="room_id">
                                    </div>
<!--                                    <div class="layui-form-mid layui-word-aux">
                                        <span class="x-red">*</span>将会成为您
                                    </div>-->
                                </div>
                            </td>
                            <td>
                                <div class="layui-form-item">
                                    <label for="username" class="layui-form-label">
                                        <span class="x-red">身份证</span>
                                    </label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="credentials" required="" lay-verify="required"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="layui-form layui-col-space5">
                                    <label for="username" class="layui-form-label">
                                        <span class="x-red">抵达时间</span>
                                    </label>
                                    <div class="layui-input-inline layui-show-xs-block">
                                        <input class="layui-input" placeholder="" id="in_time" value="{$time}" >
                                    </div>
                                </div>
                            </td>
                            <td>
                                <div class="layui-form layui-col-space5">
                                    <label for="username" class="layui-form-label">
                                        <span class="x-red">离店时间</span>
                                    </label>
                                    <div class="layui-input-inline layui-show-xs-block">
                                        <input class="layui-input" placeholder="" id="move_time" i>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <button  class="layui-btn" type="button" onclick="adds()">
                        增加
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script>layui.use(['laydate', 'form'],
    function() {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#move_time' //指定元素
        });
    });

    function adds(){
        $.ajax({
            type:"post",
            url: "{:url('home/subscribe/subscribe_date')}",
            data: {
                room_id:$('#room_id').val(),
                guest_name:$('#guest_name').val(),
                credentials:$('#credentials').val(),
                in_time:$('#in_time').val(),
                move_time:$('#move_time').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }

</script>


</html>